void main(List<String> args) {
  sayhi0("yjh");
  sayhi1("kexuancanshu", 1);
  sayhi1("kexuancanshu", null, 1.99);
  sayhi2("命名可选参数", height: 1.33);
  sayhi3("xxgc", age: 12);
}

// 必选参数
void sayhi0(String name) {
  print(name);
}

// dart中没有函数的重载
// 可选参数：位置可选参数-命名可选参数
// 注意只有可选参数才可以有默认值
// 位置可选参数
void sayhi1(String name, [int? age, double? height]) {
  print(name + age.toString() + height.toString());
}

// 命名可选参数
void sayhi2(String name, {int? age, double? height}) {
  print(name + age.toString() + height.toString());
}

// 可选参数默认值情况
void sayhi3(String name, {int age = 19, double height = 3.14}) {
  print(name + age.toString() + height.toString());
}
